package cn.iocoder.yudao.module.system.convert.investment;

import cn.hutool.db.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.investment.vo.InvestmentRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.investment.SystemInvestment;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author 梁富贵
 * @Date 2024/10/10
 **/
public class InvestmentToResp {

    public static List<InvestmentRespVO> convertList(List<SystemInvestment> systemInvestments, Map<Long, String> merchantNameMap,Map<Long, String> address) {
        List<InvestmentRespVO> list = new ArrayList<>();
        systemInvestments.forEach(item -> {
            InvestmentRespVO vo = new InvestmentRespVO();
            vo.setId(item.getId());
            vo.setMerchantId(item.getMerchantId());
            vo.setMerchantName(merchantNameMap.get(item.getMerchantId()));
            vo.setName(item.getName());
            vo.setDescription(item.getDescription());
            vo.setDescriptionUrl(item.getDescriptionUrl());
            vo.setContactPerson(item.getContactPerson());
            vo.setContactPhone(item.getContactPhone());
            vo.setContactEmail(item.getContactEmail());
            vo.setContactAddress(address.get(item.getMerchantId()));
            vo.setStatus(item.getStatus());
            vo.setStartDate(item.getStartDate());
            vo.setEndDate(item.getEndDate());
            list.add(vo);
        });

        return list;
    }
}
